package com.guidance.guidance.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.guidance.guidance.domain.GoodProject;
import com.guidance.guidance.domain.Message;
import com.guidance.guidance.repository.GoodProjectRepository;

@RestController
@RequestMapping("/goodProject")
public class GoodProjectController {
	
	@Autowired
	private GoodProjectRepository goodProjectRepository;
	
	
	/**
	 * 获取所有的优秀项目
	 * @param msg
	 * @return
	 */
	@RequestMapping("/getGoodProject")
	public Message<List> getGoodProject(Message<List> msg){
		List<GoodProject> gp = goodProjectRepository.findAll();
		if(gp.size() != 0 && gp != null) {
			msg.setCode("200");
			msg.setMsg("获取优秀项目成功");
			msg.setSuccess("true");
			msg.setData(gp);
		}else {
			msg.setCode("404");
			msg.setMsg("获取优秀项目失败");
			msg.setSuccess("false");
		}
		return msg;
	}
}
